<?

session_start();

require("../../classCol.php");

require("../../models/GFetchers.php");
require("../../models/GHandlers.php");
require("../../helpers/CHtml.php");
require("../../helpers/CJavascript.php");

require("../models/fetchers.php");

$srcDbHdr     = "SEQ_BACKUP_HDR";
$srcDbDtl     = "SEQ_BACKUP_DTL";
$srcDbMstSeq  = "MST_SEQUENCE"; 

$CHtml      = new CGHtml;
$CJS        = new CGJavascript;
$CBackup    = new CGDataBackup;
$COracle    = new oracleDb;

/**
* Shows the user list
*
*/
$COracle->init($_SESSION["ORCL"], 
               $_SESSION["OPASS"],
               $_SESSION["SID"],
               _NO_COMMENT);

/**
* fetch the current entry
*
*/
if($COracle->connect()){
  
  fetchSeqDetail($COracle,
                 $srcDbMstSeq,
                 $nSeq,
                 $seqDetail);
}else{
  
  usrDieJs("Error: Oracle connection failed!");
}

$COracle->dc();

/**
* Backup process
*
*/
$COracle->init($_SESSION["ORCLBO"], 
               $_SESSION["OPASS"],
               $_SESSION["SID"],
               _NO_COMMENT);

if($COracle->connect()){
  
  $CBackup->backupSequence($COracle,
                           $nSeq,
                           $seqDetail,
                           $srcDbHdr,
                           $srcDbDtl);
}else{
  
  usrDieJs("Error: Oracle connection failed!");
}

$COracle->commit();

$COracle->dc();

?>